<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		// 根据课件动物类的例子，尝试动物飞的方法，然后子类进行重写，实现多态。
		<script type="text/javascript">
			function Animal(type){
				this.type=type;
			}
			Animal.prototype.fly=function(){
				console.log(this.type+"飞");
			}
			function F(){}
			F.prototype=Animal.prototype;
			
			function Bird(type){
				Animal.call(this,"鸟");
			}
			Bird.prototype=F.prototype;
			Bird.prototype.constructor=Bird;
			
			Bird.prototype.fly=function(){
				console.log(this.type+"扑腾扑腾的飞");
			}
			let bird=new Bird();
			bird.fly();
			
			function Skeeter(type){
				Animal.call(this,"蚊子");
			}
			Skeeter.prototype=F.prototype;
			Skeeter.prototype.constructor=Skeeter;
			
			Skeeter.prototype.fly=function(){
				console.log(this.type+"嗡嗡的飞");
			}
			let skeeter=new Skeeter();
			skeeter.fly();
		</script>
	</body>
</html>
